<%@ Page Language="VB" AutoEventWireup="false" CodeFile="EditContent.aspx.vb" Inherits="EditContent" %>

<%@ Register Src="controls/ImageLib.ascx" TagName="ImageLib" TagPrefix="uc1" %>
<%@ Register Src="controls/ImageLiblist.ascx" TagName="ImageLiblist" TagPrefix="uc2" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">

	<head runat="server">
		<style type="text/css" media="screen">
			@import url(css/cms.css);
		</style>
		<title>Edit Area Content</title>
		<script type="text/javascript" src="../js/jquery.js"></script>
		<script type="text/javascript" src="js/getCursor.js"></script>
		<script type="text/javascript">
			$(document).ready(init);

			function init()
			    {	
			
				    $("#<%=lnkCancel.ClientID%>").click(function(){return window.parent.TB_remove();});
					
					
					$("#sw_imagePicker img").mouseover(function(){
					$(this).css({border:"3px solid #0a0"})
					});
					$("#sw_imagePicker img").mouseout(function(){
					$(this).css({border:"3px solid #ccc"})
					});
					
					
					$("#sw_imagePicker img").click(function(){
					
					var filename = $(this).parent().find(".imagename").val();
					var alttag = $(this).parent().find(".imagealt").val();
					var insertval = "![" + alttag + "](user/images/" + filename + ")"
					var textEd = document.getElementById("txtEditor");
					
					insertAtCaret(textEd, insertval)
					
					
					});
					
					$("#SW_tab_editor").click(showEditor);
					$("#SW_tab_gallery").click(showGallery);
					
			    }
			function showEditor(){
			        $("#SW_editor").show();
			        $("#SW_imageLibrary").hide();
			        
			        $("#SW_tab_editor").addClass("selected");
			        $("#SW_tab_gallery").removeClass("selected");
			        return false;
				}
			function showGallery(){
			        $("#SW_editor").hide();
			        $("#SW_imageLibrary").show();
			        
			        $("#SW_tab_editor").removeClass("selected");
			        $("#SW_tab_gallery").addClass("selected");
			        return false;
				}
		</script>
	</head>
	<body class="sw_editpage">
		<form id="SW_frmEdit" runat="server">
		<div id="SW_wrapper">
			<ul id="SW_tabs">
				<li id="SW_tab_editor"><a href="#editor">Editor</a></li>
				<li id="SW_tab_gallery"><a href="#gallery">Gallery</a></li>
			</ul>
			<div id="SW_editor">
				<div id="sw_imagePicker">
					<h4>Images</h4>
					<ul>
						<uc2:ImageLiblist ID="ImgLiblist" runat="server" />
					</ul>
				</div>
				
				<div id="sw_editbox">
					<h4>Edit Content</h4>
					&nbsp;
					<asp:TextBox ID="txtEditor" runat="server" TextMode="multiLine" Columns="25" Rows="20"></asp:TextBox>
			       
					<ul class="sw_butts">
				        <li><asp:Button ID="btnSave" runat="server" Text="Save" /></li>
				        <li><asp:LinkButton ID="lnkCancel" runat="server">Cancel</asp:LinkButton></li>
					</ul>
				</div>
			</div>
				<!--What's this then?-->
		        <asp:Panel runat="server" ID="pnlCloseWindowJs" Visible="false">
		            <script type="text/javascript">
		                window.parent.TB_remove_noprompt();
		                window.parent.__doPostBack('','mode=staged');
		            </script>
		        </asp:Panel>
			<div id="SW_imageLibrary">
				<uc1:ImageLib ID="ImgLib" runat="server" />
			</div>
		</div>
			
		</form>
	</body>
</html>
